<?php

namespace app\web\model;
use think\Model;
/**

 */
class TaskCase extends Model{
    // 开启自动写入时间戳字段
    protected $autoWriteTimestamp = true;
	/* 用户模型自动完成 */
	protected $auto = ['status'];

	protected $insert = ['manage_uid','update_uid','progress'];

	protected function setStatusAttr(){
		return 1;
	}
	protected function setProgressAttr(){
		return 0;
	}
	protected function setManageUidAttr(){
		return session('user_auth')['uid'];
	}
	protected function setUpdateUidAttr(){
		return session('user_auth')['uid'];
	}
    //获取器
    public function getUpdateTimeAttr($value)
    {
        return wordTime($value);
    }
    //获取器
    public function getCreateTimeAttr($value)
    {
        return  wordTime($value);
    }
    //状态 0=删除；1=进行中；2=完成
    public function getStatusAttr($value)
    {
        $status = [0=>'删除',1=>'进行中',2=>'完成'];
        return $status[$value];
    }

    public function create_user()
    {
        return $this->hasOne('User','id','manage_uid');
    }
    public function update_user()
    {
        return $this->hasOne('User','id','update_uid');
    }

}
